<div class="fm-content">
    <!-- 最上面标题栏 -->
    <div class="title">
      <i nz-icon [type]="'desktop'"></i>
      &nbsp;&nbsp;测试台
    </div>
    <!-- 内容 -->
    <div class="work">
  
      <!-- 查询框 -->
      <div class="top">
        <input nz-input placeholder="名称" class="fm-input first-input" [(ngModel)]="fs.queryObject['name:like']" />
        <input nz-input placeholder="所属分组" class="fm-input" [(ngModel)]="fs.queryObject['group:like']" />
        <nz-select placeholder="'所属系统'" class="fm-input" [(ngModel)]="fs.queryObject['sys']"
          (nzOpenChange)="sysDic.load('0')">
          <nz-option *ngFor="let option of sysDic.datas" [nzLabel]="option.display" [nzValue]="option.id">
          </nz-option>
          <nz-option *ngIf="sysDic.isLoading" nzDisabled nzCustomContent>
            <i nz-icon type="loading" class="loading-icon"></i>加载中...
          </nz-option>
        </nz-select>
        <nz-button-group>
          <button nz-button nzType="primary" (click)="fs.loadData(true)">查询</button>
          <button nz-button (click)="fs.resetQueryObject() && fs.loadData(true)">重置</button>
        </nz-button-group>
        <div class="tool-right">
          <nz-button-group>
            <button nz-button [nzType]="'primary'" (click)="fs.addRow()">新增</button>
            <button nz-button (click)="fs.editRow()">编辑</button>
            <button nz-popconfirm nzTitle="确认删除选择项?" (nzOnConfirm)="fs.delEntitys()" nzPlacement="bottomRight"
              nz-button>删除</button>
          </nz-button-group>
        </div>
      </div>
  
      <!-- 右则样表单主体 -->
      <div class="work-content">
        <div class="table">
          <nz-table nzSize="middle" nzShowSizeChanger [nzPageSizeOptions]='[ 10, 15, 20, 30, 40, 50 ]'
            [nzFrontPagination]="false" [nzData]="fs.datas" [nzLoading]="fs.isLoading || fs.isDeleing"
            [nzTotal]="fs.rowsCount" [(nzPageIndex)]="fs.pageIndex" [(nzPageSize)]="fs.pageSize"
            (nzPageIndexChange)="fs.loadData()" (nzPageSizeChange)="fs.loadData(true)">
            <thead>
              <tr>
                <th nzShowCheckbox [(nzChecked)]="fs.allChecked" [nzIndeterminate]="fs.indeterminate"
                  (nzCheckedChange)="fs.checkAll($event)"></th>
                <th nzWidth="20%">名称</th>
                <th nzWidth="20%">所属系统</th>
                <th nzWidth="20%">所属分组</th>
                <th nzWidth="20%">排序</th>
                <th nzWidth="20%">是否有效</th>
              </tr>
            </thead>
            <tbody>
              <tr *ngFor="let data of fs.datas">
                <td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="fs.refreshCheckStatus()">
                </td>
                <td><span (click)="fs.editRow(data)" class="form-edit">{{data.name}}</span></td>
                <td>{{data.sysName}}</td>
                <td>{{data.group}}</td>
                <td>{{data.order}}</td>
                <td>{{data.valid | boolReform }}</td>
              </tr>
            </tbody>
          </nz-table>
        </div>
      </div>
  
      <nz-modal nzWidth='830' nzTitle="编辑" [nzMaskClosable]='false' [nzFooter]="null" [(nzVisible)]="fs.isEditVisible"
        (nzOnCancel)="fs.closeEdit()">
        <form nz-form [nzLayout]="'inline'">
          <div nz-row [nzGutter]="24">
            <div nz-col [nzSpan]="12">
              <nz-form-item>
                <nz-form-label nzRequired class="form-label">名称</nz-form-label>
                <nz-form-control class="form-control" [nzValidateStatus]="names.invalid?'error':'success'" nzHasFeedback>
                  <input nz-input [(ngModel)]="fs.er.name" name="names" required #names="ngModel" />
                </nz-form-control>
              </nz-form-item>
            </div>
            <div nz-col [nzSpan]="12">
              <nz-form-item>
                <nz-form-label class="form-label">图标</nz-form-label>
                <nz-form-control class="form-control">
                  <nz-upload
                    nzAction="{{ ffs.getUploadUrl() }}"
                    [nzMultiple]="false" [nzShowUploadList]="true" 
                    [nzShowButton]="fs.er.image ? fs.er.image.length < 1 : true"
                    [(nzFileList)]="fs.er.image" name="image" [nzAccept]="'.svg'" 
                    (nzChange)="ffs.handleChange($event)">
                    <button nz-button><i nz-icon type="upload"></i><span>上传</span></button>
                  </nz-upload>
                </nz-form-control>
              </nz-form-item>
            </div>
          </div>
          <div nz-row [nzGutter]="24">
            <div nz-col [nzSpan]="24">
              <nz-form-item>
                <nz-form-label nzRequired class="form-label">web端应用地址</nz-form-label>
                <nz-form-control class="form-control3" [nzValidateStatus]="weburl.invalid?'error':'success'"
                  nzHasFeedback>
                  <input nz-input [(ngModel)]="fs.er.weburl" name="weburl" required #weburl="ngModel" />
                </nz-form-control>
              </nz-form-item>
            </div>
          </div>
          <div nz-row [nzGutter]="24">
            <div nz-col [nzSpan]="24">
              <nz-form-item>
                <nz-form-label nzRequired class="form-label">移动端应用地址</nz-form-label>
                <nz-form-control class="form-control3" [nzValidateStatus]="mobileurl.invalid?'error':'success'"
                  nzHasFeedback>
                  <input nz-input [(ngModel)]="fs.er.mobileurl" name="mobileurl" required #mobileurl="ngModel" />
                </nz-form-control>
              </nz-form-item>
            </div>
          </div>
          <div nz-row [nzGutter]="24">
            <div nz-col [nzSpan]="12">
              <nz-form-item>
                <nz-form-label nzRequired class="form-label">所属系统</nz-form-label>
                <nz-form-control class="form-control" [nzValidateStatus]="sys.invalid?'error':'success'" nzHasFeedback>
                  <nz-select [(ngModel)]="fs.er.sys" name="sys" required #sys="ngModel" (nzOpenChange)="sysDic.load('0')"
                    [nzPlaceHolder]="'请选择'">
                    <nz-option *ngFor="let option of sysDic.datas" [nzLabel]="option.display" [nzValue]="option.id">
                    </nz-option>
                    <nz-option *ngIf="sysDic.isLoading" nzDisabled nzCustomContent>
                      <i nz-icon type="loading" class="loading-icon"></i>加载中...
                    </nz-option>
                    <span *ngIf="!sysDic.isLoaded">
                      <nz-option [nzLabel]="fs.er.sysName" [nzValue]="fs.er.sys">
                      </nz-option>
                    </span>
                  </nz-select>
                </nz-form-control>
              </nz-form-item>
            </div>
            <div nz-col [nzSpan]="12">
              <nz-form-item>
                <nz-form-label nzRequired class="form-label">所属分组</nz-form-label>
                <nz-form-control class="form-control" [nzValidateStatus]="group.invalid?'error':'success'" nzHasFeedback>
                  <input nz-input [(ngModel)]="fs.er.group" name="group" required #group="ngModel" />
                </nz-form-control>
              </nz-form-item>
            </div>
          </div>
          <div nz-row [nzGutter]="24">
            <div nz-col [nzSpan]="12">
              <nz-form-item>
                <nz-form-label nzRequired class="form-label">排序值</nz-form-label>
                <nz-form-control class="form-control" [nzValidateStatus]="order.invalid?'error':'success'" nzHasFeedback>
                  <nz-input-number [(ngModel)]="fs.er.order" name="order" required #order="ngModel" [nzMin]="1"
                    [nzMax]="100" [nzStep]="1" class="form-control">
                  </nz-input-number>
                </nz-form-control>
              </nz-form-item>
            </div>
            <div nz-col [nzSpan]="12">
              <nz-form-item>
                <nz-form-label nzRequired class="form-label">是否有效</nz-form-label>
                <nz-form-control class="form-control">
                  <nz-switch nzCheckedChildren="有" nzUnCheckedChildren="无" [(ngModel)]="fs.er.valid" name="valid">
                  </nz-switch>
                </nz-form-control>
              </nz-form-item>
            </div>
          </div>
          <div nz-row [nzGutter]="24">
            <div nz-col [nzSpan]="24" class="form-button-align">
              <button nz-button nzType="default" (click)="fs.closeEdit()" class="form-button">取消</button>
              <button nz-button nzType="primary" [disabled]="names.invalid || weburl.invalid || mobileurl.invalid || group.invalid || sys.invalid || order.invalid" (click)="fs.save()"
                [nzLoading]="fs.isSaveing">保存</button>
            </div>
          </div>
        </form>
      </nz-modal>
    </div>
  </div>
  